package cn.echoedu.command;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

import javax.servlet.http.HttpServletResponse;

import cn.echoedu.command.base.Command;
import cn.echoedu.util.L;

public abstract class BaseCommand  implements Command{

	public void send(String sendjson, HttpServletResponse response){
		L.p("())()()()()("+sendjson+")()()()()");
		String str="";
		   try {
			str=java.net.URLEncoder.encode(sendjson,"utf-8");
		} catch (UnsupportedEncodingException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
//		   java.net.URLDecoder.decode(s)
			PrintWriter pw;
			try {
				response.setCharacterEncoding("utf-8");
				pw = response.getWriter();
				 
				pw.print(str);
				pw.flush();
				pw.close();
				L.p("&*&*&*&*&*&*&*&*&*&send data ok&*&*&*&*&*&*&*&");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}

	}
}
